package com.gdd.videos.service.impl;

import com.gdd.videos.mapper.BgmMapper;
import com.gdd.videos.pojo.Bgm;
import com.gdd.videos.service.BgmService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author zhangh     
 * @version V1.0.0
 * @projectName parent
 * @title     BgmServiceImpl   
 * @package    com.gdd.videos.service.impl  
 * @date   2019/9/6 16:56  
 * @explain
 */
@Service
public class BgmServiceImpl implements BgmService {

    @Autowired
    private BgmMapper bgmMapper;

    /**
     * 获取所有bgm信息
     */
    @Transactional(propagation = Propagation.SUPPORTS)
    public List<Bgm> selectAll() throws Exception{
        List<Bgm> bgms = bgmMapper.selectByExample(null);
        return bgms;
    }


    /**
     * 根据id查找bgm
     * @param bgmId
     * @return
     */
    @Transactional(propagation = Propagation.SUPPORTS)
    public Bgm findById(String bgmId) throws Exception{
        Bgm bgm = bgmMapper.selectByPrimaryKey(bgmId);
        return bgm;
    }
}
